﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace OMEGA.ControlLibrary
{
    /// <summary>
    /// 照片列表容器
    /// </summary>
    public class ImageListView : FlowLayoutPanel
    {
        public ImageListView()
        {
            this.AutoScroll = true;
        }

        /// <summary>
        /// 获取照片信息集合
        /// </summary>
        /// <returns></returns>
        public IList<ImageParams> GetParams()
        {
            IList<ImageParams> list = new List<ImageParams>();
            ImageParams imageParams;
            foreach (Control control in this.Controls)
            {
                if (control is ImageCombo)
                {
                    ImageCombo combo = control as ImageCombo;
                    imageParams = new ImageParams();
                    imageParams.Count = combo.Count;
                    imageParams.ImagePath = combo.ImagePath;
                }
            }

            return list;
        }

        /// <summary>
        /// 初始化图片ListView
        /// </summary>
        /// <param name="list">照片信息集合</param>
        public void InitParams(IList<ImageParams> list)
        {
            this.Controls.Clear();
            foreach (ImageParams item in list)
            {
                ImageCombo combo = new ImageCombo();
                combo.InitView(item);
                this.Controls.Add(combo);
            }
        }
    }




}
